<!DOCTYPE html>
<html>
<h1>JavaScript Functions</h1>
<p>Call a function which performs a calculation and returns the result:</p>
<p id="demo"></p>
<p></p>
<p>Convert Fahrenheit to Celsius:</p>
<p id="value"></p>
<p></p>
<p>Accessing a function without () returns the function and not the function result:</p>
<p id="func"></p>

<script>
    function myfuction(p1, p2) {
        // here I want p1 times p2
        return p1 * p2;
        // The problem is how can i pass a number from js to html?
    }
    let result = myfuction(4, 3)
    // use dom
    document.getElementById("demo").innerHTML = result

    function toCelsius(fahrenheit) {
        return (fahrenheit - 32) * (5 / 9);
    }
    let value = toCelsius(72)
    document.getElementById("value").innerHTML = value
    let func = toCelsius
    document.getElementById("func").innerHTML = func

</script>

</html>